package com.leejxx.health.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author LeeJx
 * @ClassName WebConfiguration
 * @Description TODO
 * @date 2020/12/29 14:27
 * @Version 1.0
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {

        registry.addMapping("/**")// 针对所有的请求
                .allowedOriginPatterns("*")    // 允许来自所有的域
                .allowedMethods("*")    // 允许所有的HTTP Method
                .allowCredentials(true);// 允许携带cookie
    }
}
